<?php

class CpController extends Core_Controller_Action 
{
	public function init() {	
		
	}
	
	public function authAction() {
		if( $this->_request->isPost() ) {
			$adapter = new Core_Auth_Adapter($this->_getParam('email'), md5( $this->_getParam('password') ) );
			$result = Zend_Auth::getInstance()->authenticate($adapter);
			if( Zend_Auth::getInstance()->hasIdentity() ) {
					$this->_redirect( 'cp' );
			}
		}
	}
	
	public function indexAction() {

	}

	
	public function logoutAction() {
		$this->_helper->layout->disableLayout();
		$this->_helper->viewRenderer->setNoRender();
		
		Zend_Auth::getInstance()->clearIdentity();
		$this->_redirect('/cp/auth');
	}
	
}
